1. Field of the Invention
The present invention generally relates to the execution of interpreted languages, and more particularly, to increasing the performance of Java interpreted language execution in application software.
2. Description of Related Art
As known in the art, the Internet is a world-wide collection of networks and gateways that use the TCP/IP suite of protocols to communicate with one another. At the heart of the Internet is a backbone of high speed data communication lines between major nodes or host computers consisting of thousands of commercial, government, educational and other computer systems that route data and messages.
The World Wide Web (WWW) refers to the total set of interlinked hypertext documents residing on hypertext transfer protocol (HTTP) servers all around the world. Documents on the WWW, commonly referred to as pages or web pages, are written in hypertext mark-up language (HTML) identified by uniform resource locators (URL) that specify the particular machine and pathname by which a file can be accessed and transmitted from node to node to the end user under HTTP. A web site is a related group of these documents and associated files, scripts, subprocedures, and databases that are served up by an HTTP server on the WWW.
Users need a browser program and an Internet connection to access a web site. Browser programs, commonly referred to as xe2x80x9cweb browsers,xe2x80x9d are client applications that enable a user to navigate the Internet and view HTML documents on the WWW, another network, or the user""s computer. Web browsers also allow users to follow codes called tags that are embedded in an HTML document, which associate particular words and images in the document with URLs so that a user can access another file that may be at any location around the world, at the press of a key or the click of a mouse. These files may contain text (in a variety of fonts and styles), graphic images, movie files and sounds as well as Java applications, other scripted languages, active X-controls or other small embedded software programs that execute when the user activates them by clicking on a link.
Scripts are applications that are executed by an HTTP server in response to a request by a client user. One type of script is a common gateway interface (CGI) script. Generally, a CGI script is invoked when a user clicks on an element in a web page, such as a link or image. CGI scripts are used to provide interactivity in a Web page. CGI scripts can be written in many languages including Java, C, C++ and Perl. A CGI-BIN is a library of CGI script applications that can be executed by an HTTP server.
Java, originally developed by Sun Microsystems, Inc. is an object-oriented, multithreaded and dynamic language that requires compilation and interpretation for execution. In the context of this document xe2x80x9cJavaxe2x80x9d shall mean xe2x80x9cJavaxe2x80x9d developed by Sun Microsystems, Inc., or any other Java-like language or derivative language developed by any other party. First, a Java application program is compiled into byte-codes by a Java compiler. This language then requires a Java virtual machine (i.e. an interpreter) to translate the compiled byte-code into machine code for a particular central processing unit (CPU) at run-time. Java permits an application (i.e. a program) to be compiled into byte-code once and then interpreted many times.
These Java applications are invoked by the HTTP daemon to do a single job, and then they exit. One problem associated with this process is the amount of time required to start up the Java virtual machine in order to execute the invoked Java application. Furthermore, when the size of the Java class files gets large, the amount of time spent loading the Java code can be a performance limiter, since the Java virtual machine dynamically loads class files only when needed.
The Java virtual machine is further slowed by the loading of all standard system objects (i.e. classes for core language, input/output, threads, applet, GUI event and image processing, security and the like) required for execution. The Java virtual machine allows for the objects to be dynamically loaded for flexibility and provides selectivity of only the objects needed to execute a particular Java application, but penalizes in terms of the speed of the Java application operation.
Until now, the overhead associated with starting the Java virtual machine and loading classes has resulted in the lack of the ability to provide high-performance execution of Java application CGI-BIN programs.
Although certain objects, advantages, and novel features of the invention are set forth in the description that follows other objects and novel features of the invention will become apparent to those skilled in the art upon examination of the following, or may be learned through the practice of the invention which are not expressly set forth herein.
The present invention is generally directed to an apparatus and method for increasing the performance of Java application execution for tasks requiring fast execution of Java applications using Java language application software. In accordance with the preferred embodiment of the present invention, the invention is accomplished by moving the code that was in the individual Java CGI-BIN script into one Java server daemon process. The individual Java CGI-BIN scripts are replaced by an object file (the proxy) that calls the daemon process to execute the code that would be in the CGI-BIN script on the proxy""s behalf. The proxy object file preferably is in C and executes Java code by invoking the Java virtual machine so very minor changes are needed to turn the Java applications into library routines.
The Java server invokes the Java virtual machine and preloads all potentially needed objects files during initialization of the Java virtual machine to speed up the actual execution of a particular Java application. The Java server accomplishes the execution of a particular Java application by forking itself and then having the child Java server run the Java class files in the already loaded Java virtual machine for the specific Java CGI-BIN script.
One of the advantages of doing this is that the Java application code in the Java server process is loaded (i.e. classes and methods) only once by the Java virtual machine when the Java server is started. In accordance with the invention, it has been determined that with large Java scripts, it is faster to connect up to the server and have it fork a child and execute the correct code than it is to start a new Java virtual machine, load the needed class files and execute the correct code.